
// JavaScript Document
function showInst(no,obj) 
{ 
	document.getElementById("instFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("instFloatdiv"+no).style.top=(obj.offsetTop+26)+'px';
	document.getElementById("instFloatdiv"+no).style.visibility='visible';
	document.getElementById("instFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("instFloatdiv"+no).style.width='650px'; 
	document.getElementById('instOverlay'+no).style.overflow='scroll';
	document.getElementById('instOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('instOverlay'+no).style.width=document.documentElement.scrollWidth;
	document.getElementById('instOverlay'+no).style.display='block';
}  

function hideInst(no) {
	document.getElementById("instFloatdiv"+no).style.visibility='hidden';
	document.getElementById('instOverlay'+no).style.display='none';
}




function showMerc(no,obj) 
{ 
	document.getElementById("mercFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("mercFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("mercFloatdiv"+no).style.visibility='visible';
	document.getElementById("mercFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("mercFloatdiv"+no).style.width='650px'; 
	document.getElementById('mercOverlay'+no).style.overflow='scroll';
	document.getElementById('mercOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('mercOverlay'+no).style.visibility='visible';
}  

function hideMerc(no) {
	document.getElementById("mercFloatdiv"+no).style.visibility='hidden';
	document.getElementById('mercOverlay'+no).style.visibility='hidden';
}

function showTerm(no,obj) 
{ 
	document.getElementById("termFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("termFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("termFloatdiv"+no).style.visibility='visible';
	document.getElementById("termFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("termFloatdiv"+no).style.width='650px'; 
	document.getElementById('termOverlay'+no).style.overflow='scroll';
	document.getElementById('termOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('termOverlay'+no).style.visibility='visible';
}  

function hideTerm(no) {
	document.getElementById("termFloatdiv"+no).style.visibility='hidden';
	document.getElementById('termOverlay'+no).style.visibility='hidden';
}

function showCtry(no,obj) 
{ 
	document.getElementById("ctryFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("ctryFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("ctryFloatdiv"+no).style.visibility='visible';
	document.getElementById("ctryFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("ctryFloatdiv"+no).style.width='650px'; 
	document.getElementById('ctryOverlay'+no).style.overflow='scroll';
	document.getElementById('ctryOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('ctryOverlay'+no).style.visibility='visible';
}  

function hideCtry(no) {
	document.getElementById("ctryFloatdiv"+no).style.visibility='hidden';
	document.getElementById('ctryOverlay'+no).style.visibility='hidden';
}

function showPers(no,obj) 
{ 
	document.getElementById("persFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("persFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("persFloatdiv"+no).style.visibility='visible';
	document.getElementById("persFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("persFloatdiv"+no).style.width='650px'; 
	document.getElementById('persOverlay'+no).style.overflow='scroll';
	document.getElementById('persOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('persOverlay'+no).style.visibility='visible';
}  

function hidePers(no) {
	document.getElementById("persFloatdiv"+no).style.visibility='hidden';
	document.getElementById('persOverlay'+no).style.visibility='hidden';
}

function showRule(no,obj) 
{ 
	document.getElementById("ruleFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("ruleFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("ruleFloatdiv"+no).style.visibility='visible';
	document.getElementById("ruleFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("ruleFloatdiv"+no).style.width='700'; 
	document.getElementById('ruleOverlay'+no).style.overflow='scroll';
	document.getElementById('ruleOverlay'+no).style.height=document.documentElement.scrollHeight;
	document.getElementById('ruleOverlay'+no).style.visibility='visible';
}  

function hideRule(no) {
	document.getElementById("ruleFloatdiv"+no).style.visibility='hidden';
	document.getElementById('ruleOverlay'+no).style.visibility='hidden';
}

//JavaScript Document
function showRcgi(no,obj) 
{ 
	document.getElementById("rcgiFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("rcgiFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("rcgiFloatdiv"+no).style.visibility='visible';
	document.getElementById("rcgiFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("rcgiFloatdiv"+no).style.width='650px'; 
	document.getElementById('rcgiOverlay'+no).style.overflow='scroll';
	document.getElementById('rcgiOverlay'+no).style.visibility='visible';
}  

function hideRcgi(no) {
	document.getElementById("rcgiFloatdiv"+no).style.visibility='hidden';
	document.getElementById('rcgiOverlay'+no).style.visibility='hidden';
}
function showRcpi(no,obj) 
{ 
	document.getElementById("rcpiFloatdiv"+no).style.left=(obj.offsetLeft+26)+'px';  
	document.getElementById("rcpiFloatdiv"+no).style.top=(obj.offsetTop+36)+'px';
	document.getElementById("rcpiFloatdiv"+no).style.visibility='visible';
	document.getElementById("rcpiFloatdiv"+no).style.zIndex='10000'; 
	document.getElementById("rcpiFloatdiv"+no).style.width='650px'; 
	document.getElementById('rcpiOverlay'+no).style.overflow='scroll';
	document.getElementById('rcpiOverlay'+no).style.visibility='visible';
}  

function hideRcpi(no) {
	document.getElementById("rcpiFloatdiv"+no).style.visibility='hidden';
	document.getElementById('rcpiOverlay'+no).style.visibility='hidden';
}
 /** 
 * 通过全选按钮选择表格中的全部数据 
 */ 
 function setCheckedStatus(){
 	var TableData = document.getElementById("listForm:listTable");
 	var CheckAll = document.getElementById("listForm:listTable:selectAll");

 	// 判断浏览器类型，如果是IE则使用table表格获取，否则通过ID获取
 	if(navigator.userAgent.indexOf("MSIE")>0){ 
 		if(TableData != null && CheckAll != null){ 
 			for(i=1;i<TableData.rows.length;i++){ 
 				TableData.rows(i).cells(0).children.item(0).checked = CheckAll.checked; 
 			} 
 		} 
 	}else{ 
 		if(TableData != null && CheckAll != null){ 
 			for(i=0;i<TableData.rows.length -1;i++){ 
 				document.getElementById("listForm:listTable:"+i+":isSelect").checked = CheckAll.checked; 
 			} 
 		} 
 	} 
 }
 function updateIDs(){

 	var TableData = document.getElementById("listForm:listTable");
 	var multinomial = document.getElementById("listForm:multinomial");

 	// 当限制机构单选时，用户多选后提交前，弹出提示。
 	if (multinomial.value == "false") {
 		var index = 0;
 		if(navigator.userAgent.indexOf("MSIE") > 0){
 			if(TableData != null){
 				for(i = 1; i < TableData.rows.length - 1; i++){ 
 					var checkboxObj = TableData.rows(i).cells(0).children.item(0);
 					var isChecked = checkboxObj.checked; 
 					if(isChecked){
 						index++;
 						if (index > 1) {
 							alert("只能选择一个！");
 							return false;
 						}
 					}
 				}
 			}
 		} else {
 			if (TableData != null) {
 				for (i = 0; i < TableData.rows.length - 1; i++) { 
 					var checkboxObj = document.getElementById("listForm:listTable:" + i + ":isSelect").checked;
 					var isChecked = checkboxObj.checked; 
 					if(isChecked){
 						index++;
 						if (index > 1) {
 							alert("只能选择一个！");
 							return false;
 						}
 					}
 				} 
 			} 
 		}		
 	}

 	// 得到父亲页面
 	// var parent = window.opener;
 	var strValue = "";
 	var strCode = "";

 	
 	// 判断浏览器类型，如果是IE则使用table表格获取，否则通过ID获取
 	if(navigator.userAgent.indexOf("MSIE") > 0){ 
 		if(TableData != null){ 
 			for(i=1;i<TableData.rows.length - 1;i++){ 
 				var checkboxObj = TableData.rows(i).cells(0).children.item(0);
 				var hiddenObjCode = TableData.rows(i).cells(0).children.item(1);
 				var	hiddenObjValue = TableData.rows(i).cells(0).children.item(2);
 				var isChecked = checkboxObj.checked; 
 				if(isChecked){
 					// 选中的代码处理
 					strValue = strValue + hiddenObjValue.value + ",";
 					strCode = strCode + hiddenObjCode.value + ",";
 				}
 			} 
 		} 
 	}else{
 		if(TableData != null){ 
// 			alert("TableData.rows.length="+TableData.rows.length);
 			for(i=0;i<TableData.rows.length -2;i++){ 

// 				alert("document1="+document.getElementById("listForm:listTable:"+i+":isSelect"));
// 				alert("document2="+document.getElementById("listForm:listTable:"+i+":isSelect"));
 				var checkboxObj = document.getElementById("listForm:listTable:"+i+":isSelect");
 				var hiddenObjCode = document.getElementById("listForm:listTable:"+i+":hiddenId");
 				var hiddenObjValue = document.getElementById("listForm:listTable:"+i+":hiddenName");
 				var isChecked = checkboxObj.checked; 
 				if(isChecked){
 					// 选中的代码处理
 					strValue = strValue + hiddenObjValue.value + ",";
 					strCode = strCode + hiddenObjCode.value + ",";
 				}
 			} 
 		}
 	}

 	if (strValue.length > 0) {
 		// 去除代码串末尾多余的“，”
 		strValue = strValue.substring(0, strValue.length - 1);
 	}
 	if (strCode.length > 0) {
 		// 去除代码串末尾多余的“，”
 		strCode = strCode.substring(0, strCode.length - 1);
 	}


 	// 父亲页面存在时修改父亲页面上的值。

 		
 		var formId = document.getElementById("listForm:formId").value;
 		var elemId = document.getElementById("listForm:elemId").value;
 		var hiddenElemId = document.getElementById("listForm:hiddenElemId").value;

 		var instID = parent.document.getElementById(formId+":"+elemId);
 		var hiddenInstID = parent.document.getElementById(formId+":"+hiddenElemId);
 	    if(instID){
 	    	instID.value = strValue;
 	    }
 	    if(hiddenInstID){
 	    	hiddenInstID.value = strCode;
 	    }
 	   for(z=1;z<6;z++){
	 	    if(parent.document.getElementById('instFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("instFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('instOverlay'+z).style.visibility='hidden';
	 	    }
	 	    if(parent.document.getElementById('mercFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("mercFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('mercOverlay'+z).style.visibility='hidden';
	    	}
	 	    if(parent.document.getElementById('termFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("termFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('termOverlay'+z).style.visibility='hidden';
			}
	 	    if(parent.document.getElementById('ctryFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("ctryFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('ctryOverlay'+z).style.visibility='hidden';
			}
	 	    if(parent.document.getElementById('persFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("persFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('persOverlay'+z).style.visibility='hidden';
	 	    }
	 	    if(parent.document.getElementById('ruleFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("ruleFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('ruleOverlay'+z).style.visibility='hidden';
	 	    }
	 	    if(parent.document.getElementById('ruleFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("rcgiFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('rcgiOverlay'+z).style.visibility='hidden';
	 	    }
	 	    if(parent.document.getElementById('rcpiFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("rcpiFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('rcpiOverlay'+z).style.visibility='hidden';
	 	    }
	 	    if(parent.document.getElementById('rcgiFloatdiv'+z)!=null){
	 	    	parent.document.getElementById("rcgiFloatdiv"+z).style.visibility='hidden';
	 	    	parent.document.getElementById('rcgiOverlay'+z).style.visibility='hidden';
	 	    }
	 	   
	    }

 }
 
 function loadSelectInst(no,isMultinomial,reserve, formId, elemId, hiddenElemId){


	document.writeln("<div id=\"instOverlay"+no+"\">");
	document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	document.writeln("</iframe>");
	document.writeln("</div>");
	document.writeln("<div id=\"instFloatdiv"+no+"\">");
	document.writeln("<div class=\"float_head\">");
	document.writeln("<div class=\"float_head_text\">机构选择</div>");
	document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideInst("+no+");\" class=\"closebutton\"></a>");
	document.writeln("</div>");
	document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/instSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	document.writeln("</iframe></div>");

 }
 

 
 function loadSelectMerc(no,isMultinomial, reserve,formId, elemId, hiddenElemId){


	 document.writeln("<div id=\"mercOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"mercFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">商户选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideMerc("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/mercSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 
 function loadSelectTerm(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"termOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"termFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">终端选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideTerm("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/termSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 
 function loadSelectCtry(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"ctryOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"ctryFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">国家选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideCtry("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/ctrySelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 
 function loadSelectPers(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"persOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"persFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">人员选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hidePers("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/persSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 
 function loadSelectRule(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"ruleOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"ruleFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">规则选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideRule("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/ruleSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 function loadSelectRcgi(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"rcgiOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"rcgiFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">风险联络人组选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideRcgi("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/rcgiSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 function loadSelectRcpi(no,isMultinomial, reserve,formId, elemId, hiddenElemId){
	 document.writeln("<div id=\"rcpiOverlay"+no+"\">");
	 document.writeln("<iframe frameborder=\"0\" scrolling=\"no\" class=\"overlay_iframe\">");
	 document.writeln("</iframe>");
	 document.writeln("</div>");
	 document.writeln("<div id=\"rcpiFloatdiv"+no+"\">");
	 document.writeln("<div class=\"float_head\">");
	 document.writeln("<div class=\"float_head_text\">风险联络人选择</div>");
	 document.writeln("<a href=\"javascript:void(0)\" onclick=\"hideRcpi("+no+");\" class=\"closebutton\"></a>");
	 document.writeln("</div>");
	 document.writeln("<iframe id=\"blank2\" name=\"blank2\" onload=\"javascript:{dyniframesize('blank2');}\" frameborder=\"0\" scrolling=\"yes\" src=\"/ArsvcWeb/page/common/rcpiSelect.jsf?isMultinomial="+isMultinomial+"&formId="+formId+"&elemId="+elemId+"&hiddenElemId="+hiddenElemId+"\" class=\"floatdiv_iframe\">");
	 document.writeln("</iframe></div>");

	  }
 